package com.ruoyi.project.utils;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.dyplsapi20170525.models.BindAxnRequest;
import com.aliyun.dyplsapi20170525.models.BindAxnResponse;
import com.aliyun.teaopenapi.models.Config;
import com.google.gson.Gson;

public class Sample {

    public final static String code = "OK";

    /**
     * 使用AK&SK初始化账号Client
     *
     * @param accessKeyId
     * @param accessKeySecret
     *
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.dyplsapi20170525.Client createClient (String accessKeyId, String accessKeySecret)
            throws Exception {
        Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 您的AccessKey Secret
                .setAccessKeySecret(accessKeySecret);
        // 访问的域名
        config.endpoint = "dyplsapi.aliyuncs.com";
        return new com.aliyun.dyplsapi20170525.Client(config);
    }

    public static void main (String[] args_) throws Exception {
        java.util.List <String> args = java.util.Arrays.asList(args_);
        com.aliyun.dyplsapi20170525.Client client = Sample.createClient("LTAI5t7hDTcUBFZD6Y8Cf7Zr",
                "ZuvvK4m4ZFg3OChqn8sODMY8Oo9jKK"
        );
        BindAxnRequest bindAxnRequest = new BindAxnRequest();
        bindAxnRequest.setPoolKey("FC100000133224708");

        bindAxnRequest.setPhoneNoX("17099418381");
        bindAxnRequest.setPhoneNoA("18057644373");
        bindAxnRequest.setExpiration("2021-07-19 14:00:00");
        bindAxnRequest.setIsRecordingEnabled(true);
        // 复制代码运行请自行打印 API 的返回值
        BindAxnResponse rs = client.bindAxn(bindAxnRequest);
        JSONObject jsonObject = JSON.parseObject(new Gson().toJson(rs));
        String message = jsonObject.getJSONObject("body").getString("message");
        String codes = jsonObject.getJSONObject("body").getString("code");
        if (code.equals(message) && code.equals(codes)) {
            String secretNo = jsonObject.getJSONObject("body").getJSONObject("secretBindDTO").getString("secretNo");

        }
     /* com.aliyun.dyplsapi20170525.Client client = Sample.createClient("LTAI5t7hDTcUBFZD6Y8Cf7Zr", "ZuvvK4m4ZFg3OChqn8sODMY8Oo9jKK");
      UnbindSubscriptionRequest unbindSubscriptionRequest = new UnbindSubscriptionRequest();
      // 复制代码运行请自行打印 API 的返回值
      unbindSubscriptionRequest.setPoolKey("FC100000133224708");
      unbindSubscriptionRequest.setSecretNo("17097918468");
   
      unbindSubscriptionRequest.setSubsId("1000037488587580");
      UnbindSubscriptionResponse unbindSubscriptionResponse = client.unbindSubscription(unbindSubscriptionRequest);
      JSONObject jsonObject=JSON.parseObject(new Gson().toJson(unbindSubscriptionResponse));
      String message=jsonObject.getJSONObject("body").getString("message");
      String codes=jsonObject.getJSONObject("body").getString("code");
      if(code.equals(message)&&code.equals(codes)) {
      }
      
     
   System.out.println(new Gson().toJson(rs));
   System.out.println(st);*/
    }
}
















/*
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JOptionPane;
public class main {*/

//public static void main(String[] args) {
// TODO Auto-generated method stub
	      /*  double volume=Math.cbrt(-1);
	        double  a=Math.sqrt(-1);
	     

	        double  c=0.256*volume;
	        double  d=0.256*volume;
	        System.out.println(volume);
	        System.out.println(a);
	        System.out.println(c);
	        System.out.println(d);
	        double  e=Math.atan2(1.26,1); 
	        double  e1=Math.atan2(1.26,2); 
	        double  e2=Math.atan2(1.26,3); 
	        double  e3=Math.atan2(1.26,4); 
	        double  e4=Math.atan2(1.26,5); 
	        double  e5=Math.atan2(1.26,6); 
	        double  e6=Math.atan2(1.26,7); 
	        double  e7=Math.atan2(1.26,8); 
	        double  e8=Math.atan2(1.26,9); 
	        double  e9=Math.atan2(1.26,10); 
	        double  e10=Math.atan2(1.26,11); 
	        double  e11=Math.atan2(1.26,12); 
	        double  e12=Math.atan2(1.26,130); 
	        System.out.println(e);
	        System.out.println(e1);
	        System.out.println(e2);
	        System.out.println(e3);
	        System.out.println(e4);
	        System.out.println(e5);
	        System.out.println(e6);
	        System.out.println(e7);
	        System.out.println(e8);
	        System.out.println(e9);
	        System.out.println(e10);
	        System.out.println(e11);
	        System.out.println(e12);
	        System.out.println(e12+e11+e10+e9+e8+e7+e6+e5+e4+e3+e3+e2+e);*/
		 /*   double  num=0.0;
	        for (int i = 1; i < 21; i++) {
	        	String name="s"+i;
	        	double  s=Math.atan2(1.2,i); 
	        	if(num<4.6) {
	        		System.out.println(s+"次数"+i);
	        		num=num+s;
	        	}else {
	        		System.out.println(0.0+"次数"+i);
	        	}
			}
	        System.out.println(num);*/
		/*
		String str = "1,2,3,4".toString();
		String repStr = str.replaceAll(",","");
		int s=50;
		String strs = String.valueOf(s);*/


//}


//}
